# sysrags
from tools.OperationError import OperationError

Request = "Request"
Get = "Get"
Post = "Post"
Cookies = "Cookies"
Headers = "Headers"

# 对于字符串参数,不自动去除左右两边的空白
NoTrim = "NoTrim"
# 对于字符串参数,使用json方式对其解析
Json = "Json"


# 必须大于0
def Positive(name, value, request):
    if value is not None and float(value) > 0:
        return float(value)
    raise OperationError(-1, name + " 必须大于0", response_status=400)
